package com.ray.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.ray.bean.BomOrderBusinessMaterialBean;
import com.ray.bean.BomOrderBusinessTitleBean;
import com.ray.bean.BomOrderLevelRank;
import com.ray.bean.BomOrderMaterialBean;
import com.ray.bean.BomOrderTitleBean;
import com.ray.bean.BomToCreateOrderMaterialBean;
import com.ray.bean.BomToCreateOrderTitleBean;
import com.ray.bean.DhTotalDateBean;
import com.ray.bean.DifficultLevelRateBean;
import com.ray.bean.GlassMaterialBean;
import com.ray.bean.MyApplyForBomBean;
import com.ray.bean.TableColumnForBomOrderConfig;
import com.ray.bean.WasteRateBean;

/**
 * 文件管理Mapper
 * @author Shensg
 * 2018年1月24日
 */
public interface OrderCreateForBomOrderMapper {
	//损耗表列表
	List<WasteRateBean> getWasteRateData(@Param("bean")WasteRateBean wasteRateBean, @Param("map")Map map);
	int getWasteRateCount(@Param("bean")WasteRateBean wasteRateBean, @Param("map")Map map);
	List<WasteRateBean> getWasteRateForBomSelf(@Param("bean")WasteRateBean wasteRateBean,  @Param("map")Map map);

	//新增損耗表
	int saveWasteRate(@Param("bean")WasteRateBean wasteRateBean, @Param("map")Map map);
	int saveWasteRateForBomSelf(@Param("beans")List<WasteRateBean> wasteRateBean, @Param("map")Map map);
	//更新损耗表
	void updateWasteRate(@Param("bean")WasteRateBean wasteRateBean, @Param("map")Map map);
	//获取单条损耗表数据
	WasteRateBean getWasteRateById(@Param("bean")WasteRateBean wasteRateBean, @Param("map")Map map);
	//难易度表列表
	List<DifficultLevelRateBean> getDifficultLevelRateData(@Param("bean")DifficultLevelRateBean difficultLevelBean, @Param("map")Map map);
	int getDifficultLevelRateCount(@Param("bean")DifficultLevelRateBean difficultLevelBean, @Param("map")Map map);
	//新增难易度表
	int saveDifficultLevelRate(@Param("bean")DifficultLevelRateBean difficultLevelBean, @Param("map")Map map);
	//更新难易度表
	int updateDifficultLevelRate(@Param("bean")DifficultLevelRateBean difficultLevelBean, @Param("map")Map map);
	//获取单条难易度表数据
	DifficultLevelRateBean getDifficultLevelRateById(@Param("bean")DifficultLevelRateBean difficultLevelBean, @Param("map")Map map);
	//bom清单列表
	List<BomOrderTitleBean> getBomOrderTitleListData(@Param("bean")BomOrderTitleBean bomOrderTitleBean, @Param("map")Map map);
	int getBomOrderTitleListCount(@Param("bean")BomOrderTitleBean bomOrderTitleBean, @Param("map")Map map);
	//新增bom订单抬头
	int saveBomOrderTitle(@Param("bean")BomOrderTitleBean titleBean , @Param("map")Map map);
	//校验工厂型号在bom订单中唯一
	int hasFactoryNoCount(@Param("factoryNo")String factoryNo , @Param("map")Map map);
	//批量保存bom_order_detail bom订单物料信息
	void saveBomOrderDetailBatch(List<BomOrderMaterialBean> bomOrderMaterialBeans);
	//判断bom订单是否审核
	int hasAuditById(@Param("id")int id);
	//更新bom_order_title 状态
	void updateBomOrderTitleStatus(@Param("status")int status , @Param("id")int id ,@Param("map")Map map);
	void updateBomOrderTitleStatusBySerialNo(@Param("status")int status , @Param("serialNo")String serialNo ,@Param("map")Map map);

	//获取bom_order_detail数据通过titleId
	List<BomOrderMaterialBean> getBomOrderDetailByTitleId(@Param("titleId")int titleId,@Param("lineNo")Integer lineNo);
	//获取商务订单列表
	List<BomOrderBusinessTitleBean> getBomOrderBusinessListData(@Param("bean")BomOrderBusinessTitleBean bomOrderBusinessTitleBean,
			@Param("map")Map map);
	int getBomOrderBusinessListCount(@Param("bean")BomOrderBusinessTitleBean bomOrderBusinessTitleBean,
			@Param("map")Map map);
	//校验商务订单编号唯一
	int hasOrderNoCountForBusiness(@Param("orderNo")String orderNo,  @Param("map")Map map);
	int saveBomOrderBusinessTitle(@Param("bean")BomOrderBusinessTitleBean titleBean, @Param("map")Map map);
	//批量保存bom_order_business_detail bom订单物料信息
	void saveBomOrderBusinessDetailBatch(List<BomOrderBusinessMaterialBean> bomOrderBusinessMaterialBeans);
	//判断商务订单是否审核
	int hasAuditForBusinessById(@Param("id")int id);
	//更新bom_order_Business_title 状态
	void updateBomOrderBusinessTitleStatus(@Param("status")Integer status , @Param("bean")BomOrderBusinessTitleBean bean,@Param("map")Map map);
	List<BomOrderBusinessMaterialBean> getBomOrderBusinessDetailByTitleId(@Param("titleId")int titleId,@Param("lineNo")int lineNo);
	//批量保存商务订单镜片
	void saveBomOrderBusinessGlassBatch(List<GlassMaterialBean> glassMaterialBeans);
	void saveBomOrderBusinessGlassBatchApply(List<GlassMaterialBean> glassMaterialBeans);
	//批量保存商务订单交期
	void saveBomOrderBusinessDhBatch(List<DhTotalDateBean> dhTotalDateBeans);
	//查询商务订单glass通过商务订单titleId
	List<GlassMaterialBean> getBomOrderBusinessGlassByTitleId(@Param("titleId")int titleId,@Param("lineNo")int lineNo);
	//查询商务订单大货交期通过商务订单titleId
	List<DhTotalDateBean> getBomOrderBusinessDhByTitleId(@Param("titleId")int titleId,@Param("lineNo")int lineNo);
	//获取表格配置
	TableColumnForBomOrderConfig getSystemTableConfigForBomOrder(@Param("map")Map map);
	TableColumnForBomOrderConfig getSystemTableConfigForBomOrderForApply(@Param("map")Map map);
	//更新表格配置
	void updateSystemTableConfigForBomOrder(@Param("map")Map map);
	void updateSystemTableConfigForBomOrderForApply(@Param("map")Map map);
	void saveSystemTableConfigFromApply(@Param("applyBean")MyApplyForBomBean applyBean,@Param("serialNo")String serialNo,@Param("map")Map map);

	//申请修改
	int saveBomOrderTitleForApply(@Param("bean")BomOrderTitleBean titleBean , @Param("map")Map map);
	void saveBomOrderDetailBatchForApply(List<BomOrderMaterialBean> bomOrderMaterialBeans);
	void saveMyApplyForBom(@Param("bean")BomOrderTitleBean titleBean,@Param("map")Map map);
	List<BomOrderTitleBean> getBomOrderTitleListDataForApply(@Param("bean")BomOrderTitleBean bomOrderTitleBean, @Param("map")Map map);
	List<BomOrderMaterialBean> getBomOrderDetailByTitleIdForApply(@Param("titleId")int titleId,@Param("lineNo")Integer lineNo);
	MyApplyForBomBean getMyApplyForBom(@Param("applyBean")MyApplyForBomBean applyBean,@Param("map")Map map);
	void updateMyApplyForBomStatus(@Param("applyBean")MyApplyForBomBean applyBean,@Param("map")Map map);
	void saveMyAuditForApply(@Param("applyBean")MyApplyForBomBean applyBean,@Param("map")Map map);
	//将元数据保存到审核数据中
	int saveBomOrderTitleToAudit(@Param("applyBean")MyApplyForBomBean bean,@Param("bean")BomOrderTitleBean bomOrderTitleBean,@Param("map")Map map);
	void saveBomOrderDetailToAudit(@Param("applyBean")MyApplyForBomBean applyBean,@Param("titleId")int titleId,@Param("map")Map map);
	int saveBomOrderTitleFromApply(@Param("applyBean")MyApplyForBomBean bean,@Param("bean")BomOrderTitleBean bomOrderTitleBean,@Param("map")Map map);
	void saveBomOrderDetailFromApply(@Param("applyBean")MyApplyForBomBean applyBean,@Param("titleId")int titleId,@Param("map")Map map);
	void saveWastRateFromApply(@Param("applyBean")MyApplyForBomBean bean, @Param("serialNo")String serialNo, Map map);
	void saveBomOrderBusinessTitleApply(@Param("bean")BomOrderBusinessTitleBean titleBean, @Param("map")Map map);
	void saveBomOrderBusinessDetailBatchApply(List<BomOrderBusinessMaterialBean> bomOrderBusinessMaterialBeans);
	void saveBomOrderBusinessDhBatchApply(List<DhTotalDateBean> dhTotalDateBeans);
	List<BomOrderBusinessTitleBean> getBomOrderBusinessListDataApply(@Param("bean")BomOrderBusinessTitleBean bomOrderBusinessTitleBean,
			@Param("map")Map map);
	List<BomOrderBusinessMaterialBean> getBomOrderBusinessDetailByTitleIdForApply(@Param("titleId")int titleId,@Param("lineNo")int lineNo);
	List<GlassMaterialBean> getBomOrderBusinessGlassByTitleIdForApply(@Param("titleId")int titleId,@Param("lineNo")int lineNo);
	List<DhTotalDateBean> getBomOrderBusinessDhByTitleIdForApply(@Param("titleId")int titleId,@Param("lineNo")int lineNo);
	void saveMyApplyForBomBusiness(@Param("bean")BomOrderBusinessTitleBean titleBean,@Param("map")Map map);
	void saveBomOrderBusinessTitleToAudit(@Param("applyBean")MyApplyForBomBean applyBean, @Param("bean")BomOrderBusinessTitleBean bean, @Param("map")Map map);
	void saveBomOrderBusinessDetailToAudit(@Param("applyBean")MyApplyForBomBean applyBean, @Param("titleId")int titleId, @Param("map")Map map);
	void saveBomOrderBusinessGlassToAudit(@Param("applyBean")MyApplyForBomBean applyBean, @Param("titleId")int titleId, @Param("map")Map map);
	void saveBomOrderBusinessDhToAudit(@Param("applyBean")MyApplyForBomBean applyBean, @Param("titleId")int titleId, @Param("map")Map map);
	void saveBomOrderBusinessTitleFromApply(@Param("applyBean")MyApplyForBomBean applyBean, @Param("bean")BomOrderBusinessTitleBean bean, @Param("map")Map map);
	void saveBomOrderBusinessDetailFromApply(@Param("applyBean")MyApplyForBomBean applyBean, @Param("titleId")int titleId, @Param("map")Map map);
	void saveBomOrderBusinessGlassFromApply(@Param("applyBean")MyApplyForBomBean applyBean, @Param("titleId")int titleId, @Param("map")Map map);
	void saveBomOrderBusinessDhFromApply(@Param("applyBean")MyApplyForBomBean applyBean, @Param("titleId")int titleId, @Param("map")Map map);
	List<BomOrderLevelRank> getBomOrderLevelRankData(@Param("bean")BomOrderLevelRank bean, @Param("map")Map map);
	int getBomOrderLevelRankCount(@Param("bean")BomOrderLevelRank bean, @Param("map")Map map);
	void updateLevelRank(@Param("bean")BomOrderLevelRank bean, @Param("map")Map map);
	void saveLevelRank(@Param("bean")BomOrderLevelRank bean, @Param("map")Map map);
	void saveOrderTitleByBomOrder(@Param("titleBean")BomToCreateOrderTitleBean titleBean,@Param("map")Map map);
	void saveOrderMaterialByBomOrder(@Param("materialBeans")List<BomToCreateOrderMaterialBean> materialBeans, @Param("orderNo")String sysOrderNo,@Param("map")Map map);
	BomToCreateOrderTitleBean getOrderTitleBySysOrder(@Param("orderNo")String sysOrderNo,@Param("map")Map map);
	List<BomToCreateOrderMaterialBean> getOrderMaterialBySysOrder(@Param("orderNo")String sysOrderNo,@Param("map")Map map);
	String getTemplateIdBySysOrderNo(@Param("orderNo")String sysOrderNo);
	int saveOrderInfoForApply(@Param("titleBean")BomToCreateOrderTitleBean titleBean,@Param("map")Map map);
	void saveOrderInfoDetailForApply(@Param("materialBeans")List<BomToCreateOrderMaterialBean> materialBeans, @Param("orderNo")String sysOrderNo,@Param("map")Map map,@Param("applyId")String applyId);
	BomToCreateOrderTitleBean getOrderTitleApply(@Param("orderNo")String sysOrderNo, @Param("applyId")String applyId, @Param("map")Map map);
	List<BomToCreateOrderMaterialBean> getOrderMaterialApply(@Param("orderNo")String sysOrderNo, @Param("applyId")String applyId, @Param("map")Map map);
	String getTemplateIdApply(@Param("orderNo")String sysOrderNo, @Param("applyId")String applyId);
	
	Map getBomInfoForOpen(@Param("companyId")String companyId, @Param("lineNo")String lineNo, @Param("factoryNo")String factoryNo);
	// 判断是否存在商务订单通过工厂型号
	int hasBusinessSameFactory(@Param("factoryNo")String factoryNo ,@Param("map")Map map);
	// 判断是否存在生产订单通过订单编号
	int hasBusinessSameOrderNo(@Param("orderNo")String orderNo, @Param("map")Map map);
}
